import java.net.*;
import java.io.*;


public class tcpclient{
	public static void main(String[] args) throws IOException{

		Socket socket = new Socket("127.0.0.1",1234);

		OutputStream output = socket.getOutputStream();
		PrintWriter out = new PrintWriter(output);

		InputStreamReader in = new InputStreamReader(socket.getInputStream());
		BufferedReader read = new BufferedReader(in);

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));

		String send = null;
		String receive = null;
		while((send = stdin.readLine()) != null){
			out.println(send);
			out.flush();
			receive = read.readLine();
			System.out.println("Client receive: "+receive);
		}
		if(socket != null) {
			socket.close();
		}
	}
}